home *** CD-ROM | disk | FTP | other *** search
-
- % @(#)trans.ps 1.1 91/02/18
- %
- % Copyright (C) 1991 - Valerie Haecky.
- % All rights reserved.
- %
- % Permission is granted to copy this source, for redistribution
- % in source form only, provided the news headers in "substantially
- % unaltered format" are retained, the introductory messages are not
- % removed, and no monies are exchanged.
- %
- % Permission is also granted to copy this source, without the
- % news headers, for the purposes of making an executable copy by
- % means of compilation, provided that such copy will not be used
- % for the purposes of competition in any othello tournaments, without
- % prior permission from the authors.
- %
- % No responsibility is taken for any errors on inaccuracies inherent
- % either to the comments or the code of this program, but if reported
- % (see README file), then an attempt will be made to fix them.
- %
-
- /BoardBottom 150 def
- /BoardLeft 200 def
- /BoardWidth 816 def % divisible by 8 and 3 and 102
- /TopMargin BoardBottom BoardWidth 450 add add def
- /SquareWidth BoardWidth 8 idiv def
- /Title (Reve Transcript) def
- /TextGap 50 def
- /ScaleFactor {0.5 0.5} def
- /Gap SquareWidth 3 idiv def
- /UpX BoardLeft Gap sub def
- /OverY BoardBottom BoardWidth Gap add add def
-
- /drawBoard { % - => -
- newpath
- 2 setlinewidth
- BoardLeft BoardBottom moveto
- 4 {
- BoardWidth 0 rlineto
- 0 SquareWidth rlineto
- BoardWidth neg 0 rlineto
- 0 SquareWidth rlineto
- } repeat
- BoardWidth 0 rlineto
- 4 {
- 0 BoardWidth neg rlineto
- SquareWidth neg 0 rlineto
- 0 BoardWidth rlineto
- SquareWidth neg 0 rlineto
- } repeat
- 0 BoardWidth neg rlineto
- stroke
- } def
-
- /labelBoard { % - => -
- newpath
- 0 setgray
- /Helvetica-Bold findfont 30 scalefont setfont
-
- UpX BoardBottom Gap add moveto (8) show
- UpX BoardBottom Gap SquareWidth add add moveto (7) show
- UpX BoardBottom Gap SquareWidth 2 mul add add moveto (6) show
- UpX BoardBottom Gap SquareWidth 3 mul add add moveto (5) show
- UpX BoardBottom Gap SquareWidth 4 mul add add moveto (4) show
- UpX BoardBottom Gap SquareWidth 5 mul add add moveto (3) show
- UpX BoardBottom Gap SquareWidth 6 mul add add moveto (2) show
- UpX BoardBottom Gap SquareWidth 7 mul add add moveto (1) show
-
- BoardLeft Gap add OverY moveto (a) show
- BoardLeft Gap SquareWidth add add OverY moveto (b) show
- BoardLeft Gap SquareWidth 2 mul add add OverY moveto (c) show
- BoardLeft Gap SquareWidth 3 mul add add OverY moveto (d) show
- BoardLeft Gap SquareWidth 4 mul add add OverY moveto (e) show
- BoardLeft Gap SquareWidth 5 mul add add OverY moveto (f) show
- BoardLeft Gap SquareWidth 6 mul add add OverY moveto (g) show
- BoardLeft Gap SquareWidth 7 mul add add OverY moveto (h) show
- } def
-
- /drawStar { % mul1 mul2 => -
- newpath
- 0 setgray
- BoardLeft SquareWidth 4 -1 roll mul add % mul2 x
- exch
- BoardBottom SquareWidth 3 -1 roll mul add % y
- SquareWidth 90 sub 2 idiv 0 360 arc fill
- } def
-
- /drawStars { % - => -
- newpath
- 2 6 drawStar
- 2 2 drawStar
- 6 2 drawStar
- 6 6 drawStar
- } def
-
- /showTitle { % - => -
- newpath
- /Helvetica-Bold findfont
- 40 scalefont
- setfont
- BoardLeft Gap sub TopMargin moveto
- Title show
-
- % Now for the other fields:
- /Helvetica findfont
- 30 scalefont setfont
-
- BoardLeft TopMargin TextGap 1 mul sub moveto
- (Black: ) show
- BlackPlayer show
-
- BoardLeft TopMargin TextGap 2 mul sub moveto
- (White: ) show
- WhitePlayer show
-
- BoardLeft TopMargin TextGap 3 mul sub moveto
- (Score: ) show
- Score show
-
- BoardLeft TopMargin TextGap 4 mul sub moveto
- (Date: ) show
- Date show
-
- BoardLeft TopMargin TextGap 5 mul sub moveto
- (Place: ) show
- Place show
-
- BoardLeft TopMargin TextGap 6 mul sub moveto
- (Time Limit: ) show
- Time show
-
- BoardLeft TopMargin TextGap 7 mul sub moveto
- (Comments: ) show
- Comments show
- } def
-
- /drawStone { % number square color => x y
- newpath
- 2 setlinewidth
-
- % a little gray looks better on the printer and does not disturb screen
- dup 0 eq {pop 0.05} if
- dup setgray exch % number color square
-
- % The next line is a fix to change orientation. Did this instead
- % of rewrite, because we might want to do something with orientation
- % later. Then this line would become a function, and we would have
- % an additional orientation option in the c part.
- % 23 -> 32
- dup 10 mod 10 mul exch 10 idiv add
-
- dup % number color square square (use 23 as example)
- 10 mod % number color square 3
- 1 sub % number color square 2
- SquareWidth mul % number color square 204
- SquareWidth 2 idiv add % number color square 255
- BoardLeft add % number color square x
- exch % number color x square
-
- 10 idiv % number color x 2
- 9 sub neg 1 sub % number color x 6
- SquareWidth mul % number color x 612
- SquareWidth 2 idiv add
- BoardBottom add % number color x y
-
- % draw the circle
- 1 index 1 index % number color x y x y
- SquareWidth 20 sub 2 idiv 0 360 arc fill % number color x y
- 1 index 1 index % number color x y x y
- 0 setgray
- SquareWidth 20 sub 2 idiv 0 360 arc stroke
- 3 index 0 ne {drawNumber} if % only draw number if no 0
- } def
-
- /drawNumber { % number color x y => -
- newpath
- 3 index 9 gt
- {13 sub exch 15 sub exch} % ad hoc correction for centering
- {12 sub exch 9 sub exch} ifelse
- moveto % number color
- /Helvetica-Bold findfont
- 30 scalefont setfont
- 1 eq {0 setgray} {1 setgray} ifelse
- 2 string cvs show
- } def
-
- gsave
- ScaleFactor scale
- Scale scale
- showTitle
- drawBoard
- labelBoard
- drawStars
-
- % initial stones
- 0 44 1 drawStone
- 0 45 0 drawStone
- 0 54 0 drawStone
- 0 55 1 drawStone
-